import scrapy


class CommentsSpider(scrapy.Spider):
    name = "comments"
    allowed_domains = ["bilibili.com"]
    start_urls = ["https://api.bilibili.com/x/web-interface/history/cursor"]
    headers = {
        'User-Agent': 'Baiduspider',
        'Cookie': "buvid3=0DF16BCE-48A0-4F6F-BF52-8DF38C0AB15F31424infoc; i-wanna-go-back=-1; _uuid=51E103B2B-16E1-FB210-6C3F-4B8368C9A10EF32541infoc; FEED_LIVE_VERSION=V8; home_feed_column=5; DedeUserID=17142789; DedeUserID__ckMd5=33ca17603f2deabe; b_ut=5; header_theme_version=CLOSE; CURRENT_PID=4891ba30-da67-11ed-a7b7-fbfdd5c7761d; rpdid=|(umRummul~m0J'uY)uRJ~kYl; browser_resolution=1512-827; CURRENT_QUALITY=80; nostalgia_conf=-1; LIVE_BUVID=AUTO6716850999627004; is-2022-channel=1; CURRENT_BLACKGAP=0; i-wanna-go-feeds=-1; fingerprint=cf5d54c029af4578755ca7274bbefa7f; buvid_fp_plain=undefined; buvid_fp=cf5d54c029af4578755ca7274bbefa7f; b_nut=1685794123; CURRENT_FNVAL=4048; SESSDATA=34ac036b%2C1701470931%2C5dbde%2A62; bili_jct=289a8930ca365fda43725e6e2a1d130f; bp_video_offset_17142789=803978720599605200; sid=6wrgzagi; buvid4=2CCC3DA7-13D9-4F66-583B-00E6F6AE2CE634009-023041409-QMGIJd+6/0xsbrYz1l6S7Q%3D%3D; b_lsid=28A6296D_18890F1411E; PVID=4",
        'Referer': 'https://www.bilibili.com/account/history'
    }

    def parse(self, response):
        print(response.text)
        # histories = response.css('#history-list>li>.r-info>.r-txt>a::attr(href)').getall()
        # for history in histories:
        #     print(history)
        # pass
